<!--
 * @Author: 迷洛洛ywc
 * @Date: 2024-03-12 16:01:35
 * @LastEditors: 迷洛洛ywc
 * @LastEditTime: 2024-05-06 14:51:07
 * @Description: file content
-->
<template>
  <!-- 农事记录 -->
  <div class="block" style="height: 100%">
    <div class="blockFlex">
      <div
        class="missionList"
        v-for="item in missions"
        :key="item.index"
        @click="openEdit(item)"
      >
        <div class="missionInfo">
          <div class="missionInfoType">{{ item.agriName }}</div>
          <div class="missionUser">时间：<span>{{ item.startTime }}</span></div>
          <div class="missionUser">操作人：{{ item.userName }}</div>
          <div class="missionUser">备注：{{ item.remark }}</div>
        </div>
      </div>
    </div>

    <el-dialog :visible.sync="dialogVisible" width="600" append-to-body>
      <img
        :src="dialogImageUrl"
        style="display: block; max-width: 100%; margin: 0 auto"
      />
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'dataTime',
  props: {
    landMissionData: {
      type: Array
    }
  },

  data () {
    return {
      missions: [],
      dialogImageUrl: '',
      dialogVisible: false
    }
  },
  computed: {
    missionDetail () {
      return this.$store.getters.missionDetail
    }
  },
  mounted () {
    this.changeData()
  },

  methods: {
    // 数据处理
    changeData () {
      // console.log(this.landMissionData)
      this.missions = this.landMissionData
      // for (let i = 0; i < this.missions.length; i++) {
      //   if (
      //     this.missions[i].picture !== '' &&
      //     this.missions[i].picture !== null &&
      //     this.missions[i].picture !== undefined
      //   ) {
      //     this.missions[i].picture = this.landMissionData[i].picture
      //       .split(',')
      //       .map((picture) => picture)
      //   } else {
      //     this.missions[i].picture = []
      //   }
      // }
      // console.log(this.missions)
    },
    // 照片放大
    pictureBig (pic) {
      this.dialogImageUrl = pic
      this.dialogVisible = true
    },
    // 详情
    openEdit (data) {
      this.$router.push({
        path: '/shuzhongtian/dashboard/planAdd',
        query: {
          ...this.$route.query,
          planId: data.id
        }
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.blockFlex {
  display: flex;
  flex-wrap: wrap
}
.missionList {
  // height: 16.6667vw * 0.834;
  width: 32.5%;
  background: #edf1f4;
  border-radius: 12px 12px 12px 12px;
  padding: 1.0417vw * 0.834 1.0417vw;
  margin-bottom: 2vh;
  margin-right: 1%
}
.missionList:nth-child(3n) {
  margin-right: 0;
}
.missionInfo {
  // display: flex;
  .missionTime {
    width: 8.3333vw;
    // background: #19b560;
    border-radius: 8px 8px 8px 8px;
    margin-right: 20px;
    text-align: center;
    line-height: 1.5625vw * 0.834;
    font-weight: 500;
    font-size: 1.0417vw;
    // color: #fff;
  }
  .missionInfoType {
    // width: 8.1667vw;
    font-weight: 600;
    font-size: 20px;
    color: #333333;
    margin-bottom: 10px
  }
  .missionUser {
    color: #999;
    line-height: 30px;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    span {
      color: #00C586;
      font-weight: bold;
    }
  }
}
.missionRemark {
  font-weight: 400;
  font-size: 1.0417vw;
  color: #666666;
  margin: 1.0417vw * 0.834 0 0.5208vw * 0.834;
}
.farmStockList {
  width: 70vw;
  display: flex;
}
.farmsStock {
  width: 18.75vw;
  height: 3.2813vw * 0.834;
  margin-right: 1.0417vw;
  background: #e4e7e9;
  border-radius: 12px 12px 12px 12px;
  display: flex;
  line-height: 3.2813vw * 0.834;
  font-size: 0.9375vw;
  .farmsStockIcon {
    width: 1.6667vw;
    height: 1.6667vw;
    margin: auto 1.0417vw;
  }
  .farmsStockName {
    margin: 0 1.5625vw 0 0;
    color: #647f93;
    font-family: PingFang SC, PingFang SC;
    font-weight: 400;
  }
  .farmsStockNum {
    color: #647f93;
    font-family: PingFang SC, PingFang SC;
    font-weight: 400;
  }
}
.missionImg {
  margin-top: 0.5208vw * 0.834;
  width: 5.5vw;
  height: 5.5vw;
  background: #dcdedf;
  border-radius: 12px 12px 12px 12px;
  display: inline-block;
  margin-right: 0.8208vw;
  img {
    width: 5.5vw;
    height: 5.5vw;
  }
}
</style>
